﻿<demo:DynamicBasePage x:Class="DIST.LR.ZHJG.Controls.Chart.ucGagueNew"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
			 xmlns:demo="clr-namespace:DIST.LR.ZHJG.Controls.Chart"
             xmlns:System="clr-namespace:System;assembly=mscorlib" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" 
             HorizontalAlignment="Center" VerticalAlignment="Center"
                     
            xmlns:gauge="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.DataVisualization"
            xmlns:gauges="clr-namespace:Telerik.Windows.Controls.Gauge;assembly=Telerik.Windows.Controls.DataVisualization">
    <demo:DynamicBasePage.Resources>
        <ResourceDictionary
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:mscorlib="clr-namespace:System;assembly=mscorlib"
            xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
            >

            <SolidColorBrush x:Key="NeedleBackground" Color="#064AB6" />
            <SolidColorBrush x:Key="NeedleBrush" Color="Transparent" />
            <SolidColorBrush x:Key="BarBackground" telerikControls:MetroColors.Color="Accent" />
            <SolidColorBrush x:Key="BarStroke" Color="Transparent" />
            <mscorlib:Double x:Key="BarStrokeThickness">0</mscorlib:Double>
            <SolidColorBrush x:Key="MarkerBackground" telerikControls:MetroColors.Color="Marker" />
            <SolidColorBrush x:Key="GaugeForeground" telerikControls:MetroColors.Color="Strong" />
            <mscorlib:Double x:Key="NeedleEllipseSize">0.4</mscorlib:Double>
            <mscorlib:Double x:Key="NeedleEllipseStrokeThickness">35</mscorlib:Double>
            <SolidColorBrush x:Key="NeedleEllipseBrush" Color="#C1C8D0" />
            <SolidColorBrush x:Key="NeedleEllipseBackground" Color="#033E8F"/>
            <SolidColorBrush x:Key="LinearGaugeInnerBackground" Color="Transparent" />
            <SolidColorBrush x:Key="LinearGaugeInnerBorderBrush" Color="Transparent" />
            <Thickness x:Key="LinearGaugeInnerBorderThickness">0</Thickness>
            <SolidColorBrush x:Key="LinearGaugeOuterBackground" Color="Transparent" />
            <SolidColorBrush x:Key="LinearGaugeOuterBorderBrush" Color="Transparent" />
            <SolidColorBrush x:Key="HorizontalLinearGaugeInnerBackground" Color="Transparent" />
            <SolidColorBrush x:Key="HorizontalLinearGaugeOuterBackground" Color="Transparent" />
            <SolidColorBrush x:Key="LinearTickBackground" telerikControls:MetroColors.Color="Strong" />
            <SolidColorBrush x:Key="LinearScaleBarBackground" telerikControls:MetroColors.Color="Main" />
            <SolidColorBrush x:Key="GaugeInnerBackground" Color="Transparent" />
            <SolidColorBrush x:Key="GaugeInnerStroke" Color="Transparent" />
            <mscorlib:Double x:Key="GaugeInnerStrokeThickness">0</mscorlib:Double>
            <SolidColorBrush x:Key="GaugeBackground" telerikControls:MetroColors.Color="Main" />
            <SolidColorBrush x:Key="GaugeStroke" Color="Transparent" />
            <mscorlib:Double x:Key="GaugeStrokeThickness">0</mscorlib:Double>
            <mscorlib:Double x:Key="RadialScaleRadius">1</mscorlib:Double>
            <SolidColorBrush x:Key="RadialTickBackground" telerikControls:MetroColors.Color="Strong" />
            <SolidColorBrush x:Key="QuadrantGaugeInnerBackground" Color="Transparent" />
            <SolidColorBrush x:Key="QuadrantGaugeBackground" telerikControls:MetroColors.Color="Main" />
            <mscorlib:String x:Key="QuadrantGaugeNWCenter">0.82,0.82</mscorlib:String>
            <mscorlib:Double x:Key="QuadrantGaugeRadius">1</mscorlib:Double>
            <mscorlib:Double x:Key="QuadrantGaugeNWStartAngle">180</mscorlib:Double>
            <mscorlib:Double x:Key="QuadrantGaugeSweepAngle">90</mscorlib:Double>
            <mscorlib:String x:Key="QuadrantGaugeNECenter">0.18,0.82</mscorlib:String>
            <mscorlib:Double x:Key="QuadrantGaugeNEStartAngle">270</mscorlib:Double>
            <mscorlib:String x:Key="QuadrantGaugeSECenter">0.18,0.18</mscorlib:String>
            <mscorlib:Double x:Key="QuadrantGaugeSEStartAngle">0</mscorlib:Double>
            <mscorlib:String x:Key="QuadrantGaugeSWCenter">0.82,0.18</mscorlib:String>
            <mscorlib:Double x:Key="QuadrantGaugeSWStartAngle">90</mscorlib:Double>
            <SolidColorBrush x:Key="HalfGaugeInnerBackground" Color="Transparent" />
            <SolidColorBrush x:Key="HalfGaugeInnerStroke" Color="Transparent" />
            <mscorlib:Double x:Key="HalfGaugeInnerStrokeThickness">0</mscorlib:Double>
            <SolidColorBrush x:Key="HalfGaugeBackground" telerikControls:MetroColors.Color="Main" />
            <mscorlib:String x:Key="HalfGaugeNCenter">0.5,0.85</mscorlib:String>
            <mscorlib:Double x:Key="HalfGaugeRadius">1</mscorlib:Double>
            <mscorlib:Double x:Key="HalfGaugeNStartAngle">180</mscorlib:Double>
            <mscorlib:Double x:Key="HalfGaugeSweepAngle">180</mscorlib:Double>
            <SolidColorBrush x:Key="HalfGaugeInnerBackgroundReversed" Color="Transparent" />
            <SolidColorBrush x:Key="HalfGaugeInnerStrokeReversed" Color="Transparent" />
            <SolidColorBrush x:Key="HalfGaugeBackgroundReversed" telerikControls:MetroColors.Color="Main" />
            <mscorlib:String x:Key="HalfGaugeWCenter">0.85,0.5</mscorlib:String>
            <mscorlib:Double x:Key="HalfGaugeWStartAngle">90</mscorlib:Double>
            <mscorlib:String x:Key="HalfGaugeSCenter">0.5,0.15</mscorlib:String>
            <mscorlib:Double x:Key="HalfGaugeSStartAngle">0</mscorlib:Double>
            <mscorlib:String x:Key="HalfGaugeECenter">0.15,0.5</mscorlib:String>
            <mscorlib:Double x:Key="HalfGaugeEStartAngle">270</mscorlib:Double>

            <Style TargetType="gauges:FontNumberPosition">
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                <Setter Property="CornerRadius" Value="4" />
                <Setter Property="Padding" Value="1" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:FontNumberPosition">
                            <Grid>
                                <Border BorderBrush="{TemplateBinding BorderBrush}"
								        BorderThickness="{TemplateBinding BorderThickness}"
								        Background="{TemplateBinding Background}"
								        CornerRadius="{TemplateBinding CornerRadius}"
                                        Opacity="{TemplateBinding Opacity}"
                                        Margin="{TemplateBinding Padding}">
                                    <ContentPresenter VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                      HorizontalAlignment="{TemplateBinding HorizontalAlignment}" />
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <DataTemplate x:Key="FontNumberPositionTemplate">
                <Grid>
                    <TextBlock VerticalAlignment="Center"
                               HorizontalAlignment="Center"
                               Text="{Binding Content}"/>
                </Grid>
            </DataTemplate>
            <Style TargetType="gauges:BarIndicator">
                <Setter Property="Background" Value="{StaticResource BarBackground}" />
                <Setter Property="BorderBrush" Value="{StaticResource BarStroke}" />
                <Setter Property="StrokeThickness" Value="{StaticResource BarStrokeThickness}" />
                <Setter Property="gauges:ScaleObject.Location" Value="OverCenter" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:BarIndicator">
                            <Grid HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch">
                                <Path x:Name="PART_BarPath" 
                                      Fill="{TemplateBinding Background}" 
                                      Stroke="{TemplateBinding BorderBrush}"
                                      StrokeThickness="{TemplateBinding StrokeThickness}"/>
                                <Path x:Name="PART_EmptyPath" 
                                      Fill="{TemplateBinding EmptyFill}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="gauges:Marker">
                <Setter Property="gauges:ScaleObject.Location" Value="OverOutside" />
                <Setter Property="gauges:ScaleObject.RelativeHeight" Value="0.08" />
                <Setter Property="gauges:ScaleObject.RelativeWidth" Value="0.12" />
                <Setter Property="gauges:LinearScale.RotateForVertical" Value="True" />
                <Setter Property="Background" Value="{StaticResource MarkerBackground}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:Marker">
                            <Grid HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch">
                                <Polygon Points="0.5,0 1,0.5 0,0.5"
                                         Stretch="Fill"
                                         Fill="{TemplateBinding Background}"
                                         Stroke="{TemplateBinding BorderBrush}"	 
                                         StrokeThickness="{TemplateBinding BorderThickness}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="gauges:NumericIndicator">
                <Setter Property="FontFamily" Value="Arial" />
                <Setter Property="Foreground" Value="{StaticResource GaugeForeground}" />
                <Setter Property="FontSize" Value="11" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:NumericIndicator">
                            <Border BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}"
							Background="{TemplateBinding Background}"
                            CornerRadius="{TemplateBinding CornerRadius}">
                                <Grid>
                                    <StackPanel x:Name="PART_PositionPanel"
                                                Orientation="Horizontal"
                                                HorizontalAlignment="Stretch"
                                                VerticalAlignment="Stretch" />
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="gauges:StateIndicator">
                <Setter Property="gauges:ScaleObject.RelativeHeight" Value="0.1" />
                <Setter Property="gauges:ScaleObject.RelativeWidth" Value="0.1" />
                <Setter Property="gauges:ScaleObject.RelativeX" Value="0.5" />
                <Setter Property="gauges:ScaleObject.RelativeY" Value="0.25" />
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:StateIndicator">
                            <Grid>
                                <Ellipse Stretch="Fill" 
                                         Fill="{TemplateBinding Background}" 
                                         Stroke="{TemplateBinding BorderBrush}"	
                                         StrokeThickness="{TemplateBinding StrokeThickness}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <DataTemplate x:Key="GaugeRangeTemplate">
                <Grid HorizontalAlignment="Stretch" 
                      VerticalAlignment="Stretch">
                    <Path x:Name="PART_RangePath" 
                          Fill="{Binding Background}" 
                          Stroke="{Binding Stroke}"
                          StrokeThickness="{Binding StrokeThickness}"
                          Data="{Binding Geometry}"/>
                </Grid>
            </DataTemplate>
            <Style TargetType="gauges:NumericScale">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:NumericScale">
                            <Grid>
                                <ItemsPresenter />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <Canvas VerticalAlignment="Stretch"
                                    HorizontalAlignment="Stretch"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>


            <Style TargetType="gauges:Needle" x:Key="myNeedle">
                <Setter Property="gauges:ScaleObject.Location" Value="CenterOutside" />
                <Setter Property="gauges:ScaleObject.RelativeWidth" Value="0.12" />
                <Setter Property="gauges:ScaleObject.Offset" Value="0.15" />
                <Setter Property="Background" Value="#064AB6" />
                <Setter Property="BorderBrush" Value="Transparent" />
                <Setter Property="TailHeight" Value="-0.04" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:Needle">
                            <Grid x:Name="PART_Grid" >
                                <Polygon Points="0,0 1,0 0.5,1 0.5,1"
                                         Fill="{TemplateBinding Background}"
                                         Stroke="{TemplateBinding BorderBrush}"
                                         Stretch="Fill"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="gauges:Pinpoint" x:Key="myPinpoint">
                <Setter Property="gauges:ScaleObject.RelativeHeight" Value="0.5" />
                <Setter Property="gauges:ScaleObject.RelativeWidth" Value="0.5" />
                <Setter Property="StrokeThickness" Value="15" />
                <Setter Property="BorderBrush" Value="LightGray" />
                <Setter Property="Background" Value="#064AB6" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:Pinpoint">
                            <Grid HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch">
                                <Ellipse Stretch="Fill"
                                         Fill="{TemplateBinding Background}"
                                         Stroke="{TemplateBinding BorderBrush}"
                                         StrokeThickness="{TemplateBinding StrokeThickness}" >
                                </Ellipse>
                                <Ellipse Stretch="Fill"
                                         Fill="Transparent"
                                         Stroke="#E6E6E6"
                                         StrokeThickness="13" />
                                <Ellipse Stretch="Fill"
                                         Fill="Transparent"
                                         Stroke="#F1F1F1"
                                         StrokeThickness="10" />

                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <DataTemplate x:Key="MajorTickTemplate">
                <Rectangle Fill="{Binding Path=Background}" 
                           Stroke="{Binding Path=Stroke}"
                           StrokeThickness="{Binding Path=StrokeThickness}"
                           Stretch="Fill"/>
            </DataTemplate>
            <DataTemplate x:Key="MiddleTickTemplate">
                <Rectangle Fill="{Binding Path=Background}" 
                           Stroke="{Binding Path=Stroke}"
                           StrokeThickness="{Binding Path=StrokeThickness}"
                           Stretch="Fill" />
            </DataTemplate>
            <DataTemplate x:Key="MinorTickTemplate">
                <Rectangle Fill="{Binding Path=Background}" 
                           Stroke="{Binding Path=Stroke}"
                           StrokeThickness="{Binding Path=StrokeThickness}"
                           Stretch="Fill" />
            </DataTemplate>
            <DataTemplate x:Key="RadialLabelTemplate">
                <TextBlock FontFamily="{Binding FontFamily}"
                           FontSize="{Binding FontSize}"
                           FontStretch="{Binding FontStretch}"
                           FontStyle="{Binding FontStyle}"
                           FontWeight="{Binding FontWeight}"
                           Foreground="{Binding Foreground}"
                           Text="{Binding FormattedValue}" />
            </DataTemplate>
            <Style TargetType="gauges:RadialScale" x:Name="myRadialScale">
                <Setter Property="Center" Value="0.5, 1" />
                <Setter Property="Radius" Value="1" />
                <Setter Property="StartAngle" Value="180" />
                <Setter Property="SweepAngle" Value="180" />
                <Setter Property="StartWidth" Value="0.3" />
                <Setter Property="EndWidth" Value="0.3" />
                <Setter Property="Fill" Value="#8FB8D4" />

                <Setter Property="LabelTemplate" Value="{StaticResource RadialLabelTemplate}" />
                <Setter Property="LabelLocation" Value="Inside" />
                <Setter Property="Foreground" Value="Transparent" />
                <Setter Property="FontSize" Value="16" />
                <Setter Property="FontWeight" Value="Bold" />

                <Setter Property="MajorTickTemplate" Value="{StaticResource MajorTickTemplate}" />
                <Setter Property="MajorTicks" Value="10" />
                <Setter Property="MajorTickBackground" Value="White" />
                <Setter Property="MajorTickLocation" Value="OverCenter" />
                <Setter Property="MajorTickRelativeHeight" Value="0.1" />
                <Setter Property="MajorTickRelativeWidth" Value="0.015" />
                <Setter Property="MiddleTickTemplate" Value="{StaticResource MiddleTickTemplate}" />
                <Setter Property="MiddleTicks" Value="2" />
                <Setter Property="MiddleTickRelativeHeight" Value="0.05" />
                <Setter Property="MiddleTickRelativeWidth" Value="0.01" />
                <Setter Property="MiddleTickBackground" Value="White" />
                <Setter Property="MiddleTickLocation" Value="OverCenter" />
                <Setter Property="MinorTickTemplate" Value="{StaticResource MinorTickTemplate}" />
                <Setter Property="MinorTicks" Value="2" />
                <Setter Property="MinorTickRelativeHeight" Value="0.03" />
                <Setter Property="MinorTickRelativeWidth" Value="0.005" />
                <Setter Property="MinorTickBackground" Value="White" />
                <Setter Property="MinorTickLocation" Value="OverCenter" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauges:RadialScale">
                            <Grid>
                                <Path x:Name="PART_ScalePath"
                                      Stroke="{TemplateBinding Stroke}"
                                      StrokeThickness="{TemplateBinding StrokeThickness}"
                                      Fill="{TemplateBinding Fill}"
                                      VerticalAlignment="Stretch"
                                      HorizontalAlignment="Stretch" />
                                <ItemsPresenter />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <Canvas VerticalAlignment="Stretch"
							HorizontalAlignment="Stretch"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="gauge:RadSemicircleNorthGauge" x:Key="myRadSemicircleNorthGauge">
                <Setter Property="InnerBackground" Value="Transparent" />
                <Setter Property="InnerBorderBrush" Value="Transparent" />
                <Setter Property="InnerBorderThickness" Value="5" />
                <Setter Property="OuterBackground" Value="Transparent" />
                <Setter Property="OuterBorderBrush" Value="Transparent" />
                <Setter Property="OuterBorderThickness" Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="gauge:RadSemicircleNorthGauge">
                            <Grid Height="{TemplateBinding CellHeight}"
                                  Width="{TemplateBinding CellWidth}"
                                  Background="{TemplateBinding Background}">
                                <Path Stretch="Fill" 
                                      StrokeThickness="{TemplateBinding OuterBorderThickness}" 
                                      Stroke="{TemplateBinding OuterBorderBrush}" 
                                      Fill="{TemplateBinding OuterBackground}"
                                      Data="M101.987,1C156.897,1 201.572,44.8172 202.954,99.3931L202.975,101L1,101L1.02033,99.3931C2.40303,44.8172 47.0782,1 101.987,1z" />
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="4*" />
                                        <RowDefinition Height="92*" />
                                        <RowDefinition Height="4*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="2*" />
                                        <ColumnDefinition Width="96*"  />
                                        <ColumnDefinition Width="2*"  />
                                    </Grid.ColumnDefinitions>
                                    <Path Grid.Row="1"
                                          Grid.Column="1" 
                                          Stretch="Fill" 
                                          Stroke="{TemplateBinding InnerBorderBrush}"
                                          StrokeThickness="{TemplateBinding InnerBorderThickness}"
                                          Fill="{TemplateBinding InnerBackground}"      
                                          Data="M101.987,1C156.897,1 201.572,44.8172 202.954,99.3931L202.975,101L1,101L1.02033,99.3931C2.40303,44.8172 47.0782,1 101.987,1z"/>
                                </Grid>
                                <ItemsPresenter />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <Grid />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="RadialScaleSemicircleNorthStyle" TargetType="gauges:RadialScale">
                <Setter Property="Center" Value="0.5,1" />
                <Setter Property="Radius" Value="1" />
                <Setter Property="StartAngle" Value="180" />
                <Setter Property="SweepAngle" Value="180" />
                <Setter Property="LabelRotationMode" Value="SurroundOut" />
            </Style>
        </ResourceDictionary>
    </demo:DynamicBasePage.Resources>
    <Grid>
        <telerik:RadSemicircleNorthGauge Width="{Binding Width}" Height="{Binding Height}" Style="{StaticResource myRadSemicircleNorthGauge}">
            <telerik:RadialScale Min="{Binding Min}" Max="{Binding Max}" MajorTickStep="{Binding MajorTickStep}" Style="{StaticResource myRadialScale}">
                <telerik:RadialScale.Indicators>
                    <telerik:Needle x:Name="needleNorth" Value="{Binding Value}" Style="{StaticResource myNeedle}"/>
                    <telerik:Pinpoint Background="#064AB6"  StrokeThickness="25"
                                      gauges:ScaleObject.RelativeHeight="0.3"
                                      gauges:ScaleObject.RelativeWidth="0.3">
                        <telerik:Pinpoint.BorderBrush>
                            <RadialGradientBrush RadiusX="1"
                                                 RadiusY="1"
                                                 GradientOrigin="0.5,0.5">
                                <GradientStop Color="White" Offset="0.3"/>
                                <GradientStop Color="LightGray" Offset="0.5"/>
                            </RadialGradientBrush>
                        </telerik:Pinpoint.BorderBrush>
                    </telerik:Pinpoint>
                </telerik:RadialScale.Indicators>
            </telerik:RadialScale>
        </telerik:RadSemicircleNorthGauge>
    </Grid>
</demo:DynamicBasePage>